CONTENTS | INDEX | PREV | NEXT
clock
NAME
clock - return system clock value
SYNOPSIS
clock_t clk = clock(void);
FUNCTION
clock() returns the system clock in ticks. To obtain seconds from
ticks divide the returned value by CLK_TCK in <time.h>
EXAMPLE
#include <stdio.h>
#include <time.h>
main()
{
clock_t clk = clock();
long i;
clk = clk + CLK_TCK;
for (i = 0; clk - clock() > 0; ++i);
printf("The FOR loop calling clock() took %d loops in one secondn", i);
return(0);
}
INPUTS
none
RESULTS
clock_t clk; system clock time value
SEE ALSO
time, localtime, asctime, strftime, ctime